<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link type="text/css" href="/Yogiro/css/jquery-ui.css" rel="stylesheet" />	
<script type="text/javascript" src="/Yogiro/js/jquery.js"></script>
<script type="text/javascript" src="/Yogiro/js/jquery-ui.js"></script>

<script type="text/javascript">
		$(document).ready(function(){
			$( ".datepicker" ).datepicker({
				"dateFormat":"yymmdd",
				"minDate":"0",
				"maxDate":"+1Y",
				changeMonth: true,
				changeYear: true
			});
			var photoCnt=4;
			$("#addBtn").click(function(){
				photoCnt++;
				var newDiv = document.createElement("div") ;
				$(newDiv).append((photoCnt+1)+"번 사진 : <input type='file' name='upFile["+photoCnt+"]'><br>");
			   	$(newDiv).insertBefore($("#addBtn"));
				
			});
			
		});
	
		
		/*
		function addPhoto() {
			photoCnt++;
			var photoUpload = document.getElementById("photoUpload");
			var br = document.createElement("br");
			var addBtn = document.getElementById("addBtn");
			var text=document.createTextNode(photoCnt+1+"번 사진 : ");
			var inputTag = document.createElement("input");
			inputTag.setAttribute("type","file");
			inputTag.setAttribute("value","upFile["+photoCnt+"]");
			photoUpload.insertBefore(br, addBtn);
			photoUpload.insertBefore(text, addBtn);
			photoUpload.insertBefore(inputTag,addBtn);
		};
		*/
		
		
	</script>
</head>
<body>
	<form action="../reservation.do" method="post" enctype="multipart/form-data">
		<input type="hidden" name="method" value="registerProduct">
		<table align="center">
			<thead>
				<tr >
					<td colspan="2" align="center"><font color="skyblue" size="10">투어 상품 등록</font></td>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>상품명</td>
					<td><input type="text" name="productName"></td>
				</tr>
				<tr>
					<td>상품 기간</td>
					<td><input type="text" class="datepicker" name="productStartDate"> ~ 
					<input	type="text" class="datepicker" name="productEndDate"></td>
				</tr>
				<tr>
					<td>출발 시간</td>
					<td><select name="productStartTime">
					<c:forEach begin="1" end="24" var="i">
					<option value="${i}">${i}시</option>
					</c:forEach>
							
					</select></td>
				</tr>
				<tr>
					<td>소요 시간</td>
					<td><input type="text" name="productLeadtime" style="width: 30px">시간</td>
				</tr>
				<tr>
					<td>상품 정원</td>
					<td><input type="text" name="productMaximumNumber" style="width: 30px">명</td>
				</tr>
				
				<tr>
					<td>상품 코스</td>
					<td><textarea rows="3" cols="40" name="productCourse">1코스 : 코스명 → 2코스 : 코스명 → 3코스 : 코스명 → 4코스 : 코스명 → 5코스 : 코스명 
					
					</textarea></td>
				</tr>
				<tr>
					<td>상품 소개</td>
					<td><textarea rows="5" cols="40" name="productIntroduce">소개글을 입력하세요</textarea></td>
				</tr>
				<tr>
					<td>사진등록 </td>
					<td id="photoUpload">
							1번 사진 : <input type="file" name="upFile[0]"> <br>
							2번 사진 : <input type="file" name="upFile[1]"><br>
							3번 사진 : <input type="file" name="upFile[2]"><br>
							4번 사진 : <input type="file" name="upFile[3]"><br>
							5번 사진 : <input type="file" name="upFile[4]"><br>
							<input id="addBtn" type="button" value="추가" >
							  
					</td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2" align="center"><input type="submit" value="등록"></td>
				</tr>
			</tfoot>
		</table>
		
	</form>

</body>
</html>